package com.xmy.cultivate.mapper;

import com.xmy.cultivate.entity.OrderDisClan;
import com.xmy.cultivate.entity.RateQuantityPay;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

/**
 * <p>
 * 多期缴费量 Mapper 接口
 * </p>
 *
 * @author hpiggy
 * @since 2025-06-18
 */
public interface RateQuantityPayMapper extends BaseMapper<RateQuantityPay> {

    /**
     * 获取多期缴费率是否有添加过数据
     */
    @Select({"<script>",
            "SELECT",
            "* ",
            "FROM",
            "rate_quantity_pay ",
            "WHERE",
            "year_part = ${yearPart} ",
            "AND quarter_num = ${quarterNum} ",
            "AND student_id = ${studentId} ",
            "AND lesson_type = ${lessonType} ",
            "AND add_date = '${addDate}' ",
            "AND subjects_id = ${subjectsId} ",
            "AND deleted = 0",
            "AND `status` = 1",
            "limit 1 ",
            "</script>"})
    public abstract RateQuantityPay getRateQuantityPayByStudentId(@Param("yearPart") Integer yearPart,
                                                                  @Param("quarterNum") Integer quarterNum,
                                                                  @Param("studentId") Long studentId,
                                                                  @Param("lessonType") Integer lessonType,
                                                                  @Param("addDate") String addDate,
                                                                  @Param("subjectsId") Long subjectsId
    );


}
